<?php
/**
 * Created by PhpStorm.
 * User: 海峡
 * Date: 2020/11/5
 * Time: 11:11
 */
namespace App\Models\Admin;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Database\Eloquent\SoftDeletes;
class Admin extends Authenticatable
{
    use SoftDeletes;
    protected $table = 'admins';
    protected $guarded=[];
    protected $dates = ['deleted_at'];

    public function setPassWordAttribute($value)
    {
        $this->attributes['password']= bcrypt($value);
    }
//    public function getRoleIdAttribute()
//    {
//        return  $this->role()->name();
//    }
    public function role()
    {
        return $this->hasOne(Role::class,'id','role_id');
    }
//
//    public function phone()
//    {
//        return $this->hasOne(Phone::class,'uid');
//    }
}